<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>ez counter</title>

</head>
<body>

<div id="app">

    <h1>计数器：{{num}}</h1>
    <button @click="add">+</button>
    <button v-on:click="sub">-</button>
</div>


<script src="../js/vue.js"></script>

<script>
     app= new Vue({
        el:"#app",
        data:{num:0},
        methods:{
            add:function (){
                console.log("正义执行！")
                this.num++;
            },
            sub:function (){
                console.log("邪恶执行！")
                this.num--;
            }
        }
    })
</script>

</body>
</html>